ngl: Use a constant for (fp16)-1
authorMatthias Clasen <mclasen@redhat.com>
Wed, 7 Apr 2021 03:11:27 +0000 (23:11 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Thu, 8 Apr 2021 01:30:43 +0000 (21:30 -0400)
No need to convert that again for every glyph.

gsk/ngl/fp16private.h
gsk/ngl/gsknglrenderjob.c

index b285bf450cb195586cdcdf222e91de7868e04b70..3f746052882320de402d1d4304946815f0bacc39 100644 (file)
@@ -30,6 +30,8 @@
 
 G_BEGIN_DECLS
 
+#define FP16_MINUS_ONE ((guint16)48128)
+
 #ifdef GRAPHENE_USE_SSE
 
 static inline void
index 3f03148a847ea757dfd6fa2cec92a31bfb3c0c87..56832efeea15db8323606c70bbb14e197799f46c 100644 (file)
@@ -2714,7 +2714,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob     *job,
   guint last_texture = 0;
   GskNglDrawVertex *vertices;
   guint used = 0;
-  guint16 c[4];
+  guint16 c[4] = { FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE, FP16_MINUS_ONE };
   const PangoGlyphInfo *gi;
   guint i;
   int yshift;
@@ -2726,9 +2726,7 @@ gsk_ngl_render_job_visit_text_node (GskNglRenderJob     *job,
   /* If the font has color glyphs, we don't need to recolor anything.
    * We tell the shader by setting the color to vec4(-1).
    */
-  if (!force_color && gsk_text_node_has_color_glyphs (node))
-    rgba_to_half (&(GdkRGBA){ -1.f, -1.f, -1.f, -1.f }, c);
-  else
+  if (force_color || !gsk_text_node_has_color_glyphs (node))
     rgba_to_half (color, c);
 
   lookup.font = (PangoFont *)font;